package friendApplyService

import (
	"chart.zozoo.net/app/models"
	"chart.zozoo.net/core/mysql"
	"errors"
	"gorm.io/gorm"
)

// ApplyInfo 获取申请好友状态
func ApplyInfo(uid, fid int) (applyInfo *models.UserFriendsApply, err error) {

	//搜索申请信息
	applyInfo = &models.UserFriendsApply{}
	row := mysql.MysqlClient.Select("uid", "fid", "status").
		Where("uid=? and fid=?", uid, fid).First(applyInfo)
	if row.Error != nil && !errors.Is(row.Error, gorm.ErrRecordNotFound) {
		return nil, row.Error
	}

	return
}
